﻿using System;
using System.Data;
using ADO;
//using WindowsApplication1.LogIn;
namespace Service.Login
{
    class Visitor:LogIn
    {
       override public bool   EnterInterface()
        {
            return true;
        }
        //---------------------------------------------
      override  public void   Initialize(String t_ip,String t_time)
        {
            IP_      = t_ip;
            Time_  = t_time;
        }
        //-----------------------------------------------
       override public bool   IsLegal()
        {
           if(IP_ == ""|| Time_ == "")
               return false;
            if(Record())
                return true;
            return false;
        }
        //-----------------------------------------------------
      override  public bool   Record()
        {
            try
            {
                String sqlstr = "";
                sqlstr = "insert into Visitors Values( '" + IP_ + "','" + Time_ + "')";
                DataBaseAccess DAO = new DataBaseAccess();
                DAO.ExecuteDataBase(sqlstr);
            }
            catch (Exception e)
            {
                return false;
            }
            return true;
        }
        //------------------------------------
        private String   IP_;
        private String   Time_;
    }
}
